//
//  FoodDetailTableViewCell.m
//  Funny
//
//  Created by dllo on 15/11/2.
//  Copyright © 2015年 King. All rights reserved.
//

#import "FoodDetailTableViewCell.h"

@implementation FoodDetailTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.head = [[UIImageView alloc]init];
        [self.contentView addSubview:self.head];
        self.head.layer.masksToBounds = YES;
        self.head.layer.cornerRadius = 30;
        
        self.name = [[UILabel alloc]init];
        self.name.textColor = [UIColor colorWithRed:0 green:220.0 / 256.0 blue:220.0 / 256.0 alpha:1.0];
        [self.contentView addSubview:self.name];
        
        self.content = [[UILabel alloc]init];
        self.content.textColor = [UIColor grayColor];
        self.content.numberOfLines = 0;
        self.content.font = [UIFont systemFontOfSize:14];
        self.content.lineBreakMode = NSLineBreakByWordWrapping;
        [self.contentView addSubview:self.content];
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.head.frame = CGRectMake(15, 20, 60, 60);
    self.name.frame = CGRectMake(100, 10, 100, 30);
    self.content.frame = CGRectMake(100, 35, SelfWidth - 110, 60);
}

- (void)setModel:(FoodDetailModel *)model
{
    self.name.text = model.username;
    [self.head sd_setImageWithURL:[NSURL URLWithString:model.avatar] placeholderImage:[UIImage imageNamed:@"defaultHeader.png"]];
    self.content.text = [NSString stringWithFormat:@"%@",model.content ];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
